import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("user_name", ["userName"], {})
@Entity("rrz_admin", { schema: "rrzcms" })
export class RrzAdmin {
  @PrimaryGeneratedColumn({
    type: "smallint",
    name: "id",
    comment: "用户id",
    unsigned: true,
  })
  id: number;

  @Column("varchar", { name: "user_name", comment: "用户名", length: 50 })
  userName: string;

  @Column("varchar", {
    name: "pen_name",
    nullable: true,
    comment: "笔名（发布文章后显示责任编辑的名字）",
    length: 50,
  })
  penName: string | null;

  @Column("varchar", {
    name: "true_name",
    nullable: true,
    comment: "真实姓名",
    length: 50,
  })
  trueName: string | null;

  @Column("varchar", {
    name: "mobile",
    nullable: true,
    comment: "手机号码",
    length: 50,
  })
  mobile: string | null;

  @Column("varchar", {
    name: "email",
    nullable: true,
    comment: "email",
    length: 60,
  })
  email: string | null;

  @Column("varchar", { name: "password", comment: "密码", length: 32 })
  password: string;

  @Column("varchar", {
    name: "head_pic",
    nullable: true,
    comment: "头像",
    length: 255,
  })
  headPic: string | null;

  @Column("int", {
    name: "last_login",
    nullable: true,
    comment: "最后登录时间",
    unsigned: true,
    default: () => "'0'",
  })
  lastLogin: number | null;

  @Column("varchar", {
    name: "last_ip",
    nullable: true,
    comment: "最后登录ip",
    length: 15,
  })
  lastIp: string | null;

  @Column("int", {
    name: "login_cnt",
    nullable: true,
    comment: "登录次数",
    unsigned: true,
    default: () => "'0'",
  })
  loginCnt: number | null;

  @Column("varchar", {
    name: "session_id",
    nullable: true,
    comment: "session_id",
    length: 50,
  })
  sessionId: string | null;

  @Column("int", {
    name: "parent_id",
    nullable: true,
    comment: "父管理员ID",
    unsigned: true,
    default: () => "'0'",
  })
  parentId: number | null;

  @Column("int", {
    name: "role_id",
    comment: "角色组ID（-1表示超级管理员）",
    default: () => "'-1'",
  })
  roleId: number;

  @Column("varchar", {
    name: "mark_lang",
    nullable: true,
    comment: "当前语言标识",
    length: 50,
    default: () => "'cn'",
  })
  markLang: string | null;

  @Column("tinyint", {
    name: "status",
    nullable: true,
    comment: "状态(0=屏蔽，1=正常)",
    unsigned: true,
    default: () => "'1'",
  })
  status: number | null;

  @Column("int", {
    name: "syn_users_id",
    nullable: true,
    comment: "同步注册到会员表",
    unsigned: true,
    default: () => "'0'",
  })
  synUsersId: number | null;

  @Column("int", {
    name: "add_time",
    nullable: true,
    comment: "添加时间",
    unsigned: true,
    default: () => "'0'",
  })
  addTime: number | null;

  @Column("int", {
    name: "update_time",
    nullable: true,
    comment: "更新时间",
    unsigned: true,
    default: () => "'0'",
  })
  updateTime: number | null;
}
